import { Tools } from 'weaver-mobile';
import { catchApiError, PARAMS } from '../util/index';

export const myVotingNum = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/list/myVotingNum',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const myVoting = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/list/myVoting',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const result = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/list/result',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const resultView = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/result',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const partSituation = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/partSituation',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const doPerson = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/doPerson',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 未参与人员列表
export const undoPerson = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/undoPerson',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 回答
export const doPersonOfQuesion = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/doPersonOfQuesion',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 查看
export const doPersonOfInput = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/doPersonOfInput',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 其他
export const doPersonOfOther = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/doPersonOfOther',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 选项人员投票
export const doPersonOfOption = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/doPersonOfOption',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const condition = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/list/condition',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const urgentNum = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/urgentNum',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const urgent = params => {
	let options = {
		method: 'POST',
		url: '/api/voting/view/urgent',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const getUrgentContent = params => {
	let options = {
		method: 'GET',
		url: '/api/voting/view/urgentContent',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}